/* 
 * $Id: JGraphEditorAction.java,v 1.6 2009/01/20 15:42:13 gaudenz Exp $
 * Copyright (c) 2001-2005, Gaudenz Alder
 * 
 * All rights reserved.
 * 
 * See LICENSE file for license details. If you are unable to locate
 * this file please contact info (at) jgraph (dot) com.
 */
package com.jgraph.editor;

import javax.swing.Action;

/**
 * The interface of all actions in a JGraph editor kit. An action may be
 * toggable, in which case the UI factory will create an element that displays
 * the action's selection state, and listen to changes of this state to update
 * the element. The enabled state will also be listened to and the UI elements
 * will be updated accordingly.
 * 
 * @author svetoslavganov@mail.utexas.edu
 */
public interface JGraphAction extends Action {

	/**
	 * Bean property name for <code>isSelected</code>
	 */
	public final static String PROPERTY_ISSELECTED = "isSelected";

	/**
	 * Bean property name for <code>isVisible</code>
	 */
	public final static String PROPERTY_ISVISIBLE = "isVisible";

	public void setEnabled(boolean newValue);

	/**
	 * Returns the name.
	 */
	public String getName();

	/**
	 * Returns whether the UI elements should display the selection state.
	 *
	 * @return Returns true if the action is toggable.
	 */
	public boolean isToggleAction();

	/**
	 * Sets whether the UI elements should display the selection state.
	 *
	 * @param isToggleAction The isToggleAction state to set.
	 */
	public void setToggleAction(boolean isToggleAction);

	/**
	 * Returns the selection state.
	 * 
	 * @return Returns true if the action is selected.
	 */
	public boolean isSelected();

	/**
	 * Sets the selection state. Dispatches a change event.
	 *
	 * @param selected The selected state to set.
	 * 
	 * @see Action#putValue(java.lang.String, java.lang.Object)
	 */
	public void setSelected(boolean selected);

	/**
	 * Returns the visible state.
	 * 
	 * @return Returns true if the action is visible.
	 */
	public boolean isVisible();

	/**
	 * Sets the visible state. Dispatches a change event.
	 *
	 * @param visible The visible state to set.
	 *
	 * @see Action#putValue(java.lang.String, java.lang.Object)
	 */
	public void setVisible(boolean visible);
}